﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="Directory.Web.Admin_LogoView"
    Theme="Admin_Default" Codebehind="LogoView.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript">
        function $(id) {
            return document.getElementById(id);
        }
        function selectLogo(file) {
            var path = $('txtCurrentPath').value + "/" + file;
            window.opener.SetLogoPath(path);
        }
        function deletefile(file) {
            if (confirm('确认删除文件 ' + decodeURI(file) + ' 吗？')) {
                var path = $('txtCurrentPath').value;
                ajaxdeletefile(file, path);
            }
        }
        function deletedirectory(dir) {
            if (confirm('确认删除 ' + decodeURI(dir) + ' 目录吗？')) {
                var path = $('txtCurrentPath').value;
                ajaxdeletefile(dir, path);
            }
        }
        function deletecallback(result, context) {
            window.alert(result);
            window.location.reload();
        }
        function deleteerrorcalback(error, context) {
            window.alert("服务器错误");
        }
        function uploadfile() {
            var path = encodeURI($('txtCurrentPath').value);
            window.open("logoupload.aspx?CurrentPath=" + path, "文件上传", "", null);
        }
        function createfolder() {
            $('divCreateFolder').style.display = '';
        }
        function cancelcreatefolder() {
            $('divCreateFolder').style.display = 'none';
            $('folderName').value = '';
        }
        function goparent() {
            var path = $('txtParentPath').value;
            window.location = 'logoview.aspx?CurrentPath=' + path;
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="container">
        <input id="txtParentPath" type="hidden" value="<%= parentPath %>" />
        <input id="txtCurrentPath" type="hidden" value="<%= currentPath %>" />
        <div class="logo_A">
            &nbsp; &nbsp; &nbsp; <a href="#" onclick="createfolder();return false;">新建目录</a>&nbsp;
            &nbsp;&nbsp; <a href="#" onclick="uploadfile();return false;">上传<% =Resources.Resource.ResourceManager.GetString("ItemLogo") %></a>&nbsp;
            &nbsp; &nbsp; <a href="#" onclick="goparent();return false;">返回上一级目录</a>&nbsp; &nbsp;
            &nbsp;
            <input type="button" onclick="window.close();" value="关 闭" class="input_Button" />
            <div id="divCreateFolder" style="display: none;">
                文件夹：<input type="text" id="folderName" name="folderName" />
                <asp:Button ID="btnCreateFolder" runat="server" Text="创建" OnClick="btnCreateFolder_Click" />
                <input onclick="cancelcreatefolder()" type="button" value="取消" class="input_Button" />
            </div>
            <div id="divDirectoryList">
                <asp:Repeater ID="rptFolders" runat="server">
                    <HeaderTemplate>
                        <ul class="logo_file">
                    </HeaderTemplate>
                    <ItemTemplate>
                        <li><a href="logoview.aspx?CurrentPath=<%= currentPath %>/<%# Eval("Name") %>" title="打开目录">
                            <img src="/imgs/folder.gif" alt="打开目录" /></a>
                            <%# Eval("Name") %>
                            <a href="#" onclick="deletedirectory('<%# Server.UrlEncode(Eval("Name").ToString()) %>')"
                                title="删除">
                                <img src="/imgs/delete.gif" alt="删除" /></a> </li>
                    </ItemTemplate>
                    <FooterTemplate>
                        </ul></FooterTemplate>
                </asp:Repeater>
                <br />
                <br />
                <asp:Repeater ID="rptFiles" runat="server">
                    <HeaderTemplate>
                        <ul class="logos">
                    </HeaderTemplate>
                    <ItemTemplate>
                        <li><a href="#" onclick="selectLogo('<%# Server.HtmlEncode(Eval("Name").ToString()) %>')"
                            title="单击选择">
                            <img class="logo_IMG" src="<%= logoBasePath %><%= currentPath %>/<%# Eval("Name")%>"
                                alt="单击选择" /></a>
                            <%# Eval("Name") %>
                            <a href="#" onclick="deletefile('<%# Server.UrlEncode(Eval("Name").ToString()) %>')"
                                title="删除">
                                <img src="/imgs/delete.gif" alt="删除" /></a> </li>
                    </ItemTemplate>
                    <FooterTemplate>
                        </ul></FooterTemplate>
                </asp:Repeater>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
